import ctypes
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime
def plot_weather_stats(df):
    # 使用C加速的统计计算
    day_stats = df['天气状况(白天)'].value_counts()
    night_stats = df['天气状况(夜间)'].value_counts()

    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(16, 6))

    # 白天天气
    ax1.pie(day_stats, labels=day_stats.index, autopct='%1.1f%%',
            colors=plt.cm.Pastel1.colors)
    ax1.set_title('白天天气分布')

    # 夜间天气
    ax2.pie(night_stats, labels=night_stats.index, autopct='%1.1f%%',
            colors=plt.cm.Pastel2.colors)
    ax2.set_title('夜间天气分布')

    plt.tight_layout()
    plt.show()